package acceptanceTests.deleteAmessage;

import junit.framework.TestCase;
import acceptanceTests.registration.RegistrationInt;
import acceptanceTests.registration.RegistrationProxy;



public class DeleteMessageStoryTest extends TestCase {
	
	RegistrationInt _forumRegimp = new RegistrationProxy();
	DeleteMessageInt _deleteMessage= new DeleteMessageProxy(_forumRegimp.getServer());
	
	public DeleteMessageStoryTest(){
		super();
	}
	

	public void testDeleteMessage(){
		_forumRegimp.deleteRegisterUser("user1");
		assertTrue(_deleteMessage.register("user1","abc@gmail.com","password1"));
		Object tTopic1 = _deleteMessage.getLegalTopicForNewMessage("user1");
		Object tMessage =_deleteMessage.writeNewMessageReturnsMessage("test4", "body4", tTopic1, "user1");
		assertTrue(_deleteMessage.hasMessage(tMessage, "user1"));
		_deleteMessage.premoteUser("user1");
		assertTrue(_deleteMessage.deleteMessage(tMessage));
		assertFalse(_deleteMessage.hasMessage(tMessage, "user1"));
		assertTrue( _forumRegimp.deleteRegisterUser("user1") );
		_forumRegimp.deleteRegisterUser("user1");
		
	
	}
}
